package com.qys.livesMall.shop.controller.sys;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.shop.modal.entity.ShopOrderMessage;
import com.qys.livesMall.shop.modal.query.QueryOrderMessage;
import com.qys.livesMall.shop.service.ShopOrderMessageService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmx
 * @since 2023-07-11
 */
@RestController
@RequestMapping("/sys/shopOrderMessage")
public class SysShopOrderMessageController {
    @Resource
    private ShopOrderMessageService messageService;


    @PostMapping("/page")
    public R<Page<ShopOrderMessage>> page(@RequestBody QueryOrderMessage data){
        Page<ShopOrderMessage> page  = Page.of(data.getCurrent(), data.getSize());
        LambdaQueryWrapper<ShopOrderMessage> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(ShopOrderMessage::getCreateTime);
        page=messageService.page(page,wrapper);
        return R.ok(page);
    }
}
